

package com.magicking.apnswitch;

import android.os.Build;


public final class ApplicationConstants {

    public static final String STATUS_EXTRA = "com.magicking.apnswitcher.intent.extra.STATUS";
    /**
     * Intent name for send to request current apn state.
     */
    public static final String STATUS_REQUEST = "com.magicking.apnswitcher.intent.action.STATUS_REQUEST";
    /**
     * Intent name for send to switch apn state.
     */
    public static final String CHANGE_STATUS_REQUEST = "com.magicking.apnswitcher.intent.action.CHANGE_REQUEST";


    public static final String SHOW_NOTIFICATION = "com.magicking.apnswitcher.intent.extra.SHOW_NOTIFICATION";

    public static final String TARGET_MMS_STATE = "com.magicking.apnswitcher.intent.extra.TARGET_MMS_STATE";

    public static final String TARGET_APN_STATE = "com.magicking.apnswitcher.intent.extra.TARGET_STATE";

    /**
     * Intent name for returned result
     */
    public static final String APN_DROID_RESULT = "com.magicking.apnswitcher.intent.REQUEST_RESULT";
    /**
     * Extra name that holds main apn state
     */
    public static final String RESPONSE_APN_STATE = "APN_STATE";
    /**
     * Extra name that holds mms state. This extra set only if main apn state is 'off' (result == false)
     */
    public static final String RESPONSE_MMS_STATE = "MMS_STATE";
    /**
     * Intent name that holds switch result. It is {@code true} if the resulted switched request performed succesfully
     * and {@code false} otherwise.
     */
    public static final String RESPONSE_SWITCH_SUCCESS = "SWITCH_SUCCESS";

    public static final class State{
        public static final int OFF = 0;
        public static final int ON = 1;
    }

    static final String STATUS_CHANGED_MESSAGE = "com.magicking.apnswitcher.intent.action.STATUS_CHANGED";

    static final String SETTINGS_TOGGLE_BUTTON = "toggle_preference";

    static final String SETTINGS_KEEP_MMS_ACTIVE = "com.magicking.apnswitcher.preferences.KEEP_MMS_ENABLED";
    static final String SETTINGS_SHOW_NOTIFICATION = "com.magicking.apnswitcher.preferences.SHOW_NOTIFICATION";
    static final String SETTINGS_DISABLE_ALL = "com.magicking.apnswitcher.preferences.DISABLE_ALL";

    static final String SETTING_PREFERRED_APN= "preferred_apn_id";

    /**
     * Common log tag
     */
    static final String APP_LOG = "apnswitcher.log";
    
    public static int getApiLevel() {
        int sApiLevel = 0;
        if (sApiLevel == 0) {
            try {
                // SDK_INT only exists since API 4 so let's use the string version.
                sApiLevel = Integer.parseInt(Build.VERSION.SDK);
            } catch (Exception e) {
                // This app doesn't run below 3 anyway
                sApiLevel = 3;
            }
        }

        return sApiLevel;
    }

}
